create database AssWpsjPhotos
go
use AssWpsjPhotos
go
create table Account(
	id int identity primary key,
	username nvarchar(100) not null,
	pass nvarchar(100) not null,
	email nvarchar(100) not null,
	fullname nvarchar(100) not null unique
)
go
create table Album(
	id int identity primary key,
	albumname nvarchar(100) not null unique,
	desalbum nvarchar(500) not null
)
go
create table Picture(
	id int identity primary key,
	title nvarchar(100) not null,
	albumname nvarchar(100) not null,
	fullname nvarchar(100) not null,
	despic nvarchar(500) not null,
	viewtime int not null,
	foreign key (albumname) references Album(albumname),
	foreign key (fullname) references Account(fullname)
)
go
create proc insertAccount
	@username nvarchar(100),
	@pass nvarchar(100),
	@email nvarchar(100),
	@fullname nvarchar(100)

as

insert into Account values (@username,@pass,@email,@fullname)
go
create proc insertAlbum
	@albumname nvarchar(100),
	@desalbum nvarchar(500)
as
	insert into Album values (@albumname,@desalbum)
go
create  proc insertPicture
	@title nvarchar(100),
	@albumname nvarchar(100),
	@fullname nvarchar(100),
	@despic nvarchar(500),
	@viewtime int
as
	insert into Picture values (@title,@albumname,@fullname,@despic,@viewtime)
go
insert into Account(username, Pass, email, fullname)
values('admin','e3afed0047b08059d0fada10f400c1e5','admin@abc.com.vn','Nguyen admin')
go
insert into Album(albumname,desalbum)
values('timeline','fasdjfasdjfldafsdfsadgdfgadf')
go
insert into Picture(title,albumname,fullname,despic,viewtime)
values('beauty picture','timeline','Nguyen admin','adsfasdgadgaf',13)
go
insert into Picture(title,albumname,fullname,despic,viewtime)
values('haha','timeline','Nguyen admin','czvcbzcbzcbc',1)
go
select * from Picture
go
select * from Account
go
select * from Album